//父类
class Person {
  //成员属性
  name;
  age;

  constructor(name, age) {
    this.name = name;
    this.age = age;
  }

  //成员方法
  say() {
    return `我是${this.name}，我今年${this.age}岁`;
  }
}

//子类继承父类
class Student extends Person {
  study() {
    return `我是${this.name}，我喜欢学习`;
  }

  say() {
    return `我是${this.name}，我喜欢编程`;
  }
}

class Worker extends Person {
  salary() {
    return `我是${this.name}，我能赚钱`;
  }
}
let w1=new Worker("王师傅",54)
// console.log(w1.say())
console.log(w1.salary())